package logger

import (
	"log"
	"os"

	"lucidity.note/app/common"
)

var (
	// 普通级别日志
	INFO *log.Logger

	// 警告级别日志
	WARN *log.Logger

	// 错误级别日志
	FAULT *log.Logger
)

func InitLog() {
	logFile, err := os.OpenFile(common.GetLoggerFilePath(), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
	if nil != err {
		panic(err)
	}

	INFO = log.New(logFile, "[INFO] ", log.Lshortfile|log.Ltime|log.Ldate)
	WARN = log.New(logFile, "[WARN] ", log.Lshortfile|log.Ltime|log.Ldate)
	FAULT = log.New(logFile, "[ERROR] ", log.Lshortfile|log.Ltime|log.Ldate)
}
